//1.导入、加载 path 模块
const path = require('path');
//2.调用join方法构造绝对路径
console.log(path.join('aaa','bbb','ccc')); 
//在window下:aaa\bbb\ccc
//在linux下:aaa/bbb/ccc

console.log(path.join('c:/','windows','dirvers','abc'));
//c:/windows/dirvers/abc

console.log(path.join(__dirname,'comments','server.js'));
//C:\Users\lenovo\Desktop\node练习\comments\server.js

console.log(path.join('aaa','bbb/ddd\\fff','ccc\\eee'));
//aaa\bbb\ddd\fff\ccc\eee